SELECT
<#assign prefixName=' '>
<#if (select__beginDate??)>
${prefixName} T.BEGIN_DATE AS beginDate
	<#assign prefixName=','>
</#if>
<#if (select__code??)>
${prefixName} T.CODE AS code
	<#assign prefixName=','>
</#if>
<#if (select__dataOption??)>
${prefixName} T.DATA_OPTION AS dataOption
	<#assign prefixName=','>
</#if>
<#if (select__endDate??)>
${prefixName} T.END_DATE AS endDate
	<#assign prefixName=','>
</#if>
<#if (select__id??)>
${prefixName} T.ID AS id
	<#assign prefixName=','>
</#if>
<#if (select__name??)>
${prefixName} T.NAME AS name
	<#assign prefixName=','>
</#if>
<#if (select__orderCode??)>
${prefixName} T.ORDER_CODE AS orderCode
	<#assign prefixName=','>
</#if>
<#if (select__siteId??)>
${prefixName} T.SITE_ID AS siteId
	<#assign prefixName=','>
</#if>
<#if (select__target??)>
${prefixName} T.TARGET AS target
	<#assign prefixName=','>
</#if>
<#if (select__typeId??)>
${prefixName} T.TYPE_ID AS typeId
	<#assign prefixName=','>
</#if>
<#if prefixName == ' '>
  T.BEGIN_DATE AS beginDate
, T.CODE AS code
, T.DATA_OPTION AS dataOption
, T.END_DATE AS endDate
, T.ID AS id
, T.NAME AS name
, T.ORDER_CODE AS orderCode
, T.SITE_ID AS siteId
, T.TARGET AS target
, T.TYPE_ID AS typeId
</#if>
FROM C1_NAVIGATION T
<#include "whereByCode.ftl">
<#assign prefixName='ORDER BY'>
<#if (order__by__beginDate??)>
${prefixName} T.BEGIN_DATE ${order__by__beginDate__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__code??)>
${prefixName} T.CODE ${order__by__code__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__dataOption??)>
${prefixName} T.DATA_OPTION ${order__by__dataOption__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__endDate??)>
${prefixName} T.END_DATE ${order__by__endDate__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__id??)>
${prefixName} T.ID ${order__by__id__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__name??)>
${prefixName} T.NAME ${order__by__name__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__orderCode??)>
${prefixName} T.ORDER_CODE ${order__by__orderCode__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__siteId??)>
${prefixName} T.SITE_ID ${order__by__siteId__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__target??)>
${prefixName} T.TARGET ${order__by__target__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__typeId??)>
${prefixName} T.TYPE_ID ${order__by__typeId__value!}
	<#assign prefixName=','>
</#if>
